package com.example.mywanandroid.project;

import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.RecyclerView;
import com.example.mywanandroid.R;
import com.example.mywanandroid.project.ui.InitComponents;
import com.scwang.smartrefresh.layout.api.RefreshLayout;

import java.util.List;

public class ChildFragment extends Fragment {
    private View root;
    private List<ProjectRecyclerViewItem> projectRecyclerViewItems;
    public ChildFragment(List<ProjectRecyclerViewItem> projectRecyclerViewItems) {
        this.projectRecyclerViewItems = projectRecyclerViewItems;
    }
    private RecyclerView recyclerView;
    private RefreshLayout refreshLayout;

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        root = inflater.inflate(R.layout.project_child_fragment, container, false);
        // 初始化RecyclerView
        recyclerView = root.findViewById(R.id.project_recyclerview);
        InitComponents initComponents = new InitComponents();
        initComponents.initRecyclerView(recyclerView, projectRecyclerViewItems, getActivity());
        // 初始化下拉刷新
        refreshLayout = root.findViewById(R.id.project_refreshLayout);
        initComponents.initRefresh(refreshLayout, getActivity());
        return root;
    }
}
